public with sharing class Callidus_CommonUtil {


    public Task newTask(sObject sObjRec, ID ownerId, ID sObjectId, String subject, String description, Date activityDate, DateTime reminderDate, Boolean isReminderSet, String priority, String status, String taskType)
    {
        Task t = new Task();
        t.OwnerId = ownerId;
        t.WhatId = sObjectId;
        
        t.Subject = subject;
        t.Description = description;
        
        t.Status = status;
        t.Type = taskType;
        t.ActivityDate = activityDate;
        t.ReminderDateTime = reminderDate;
        t.IsReminderSet = isReminderSet;
        t.Priority = priority;
        return t;
    }
    
    public Messaging.SingleEmailMessage createNewEmail(ID whatId, ID targetId, Id emailTemplateId, Messaging.EmailFileAttachment[] fileAttachments, Boolean useSignature, Boolean setAsActivity)
    {
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();                 
        mail.setFileAttachments(fileAttachments);
        mail.setTargetObjectId(targetId);
        mail.setTemplateId(emailTemplateId);
        mail.setWhatId(whatId);
        mail.setUseSignature(useSignature);
        mail.setSaveAsActivity(setAsActivity);
        return mail;
    }
    
    public String insertTasks(Task[] taskList)
    {
        try
        {
            insert taskList;
        }
        catch(Exception e)
        {
            return e.getMessage();
        }
        return 'success';
    } 

}//end of Class CommonUtil